<script type="text/javascript">
	startList = function()
	{
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++)
		{
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI"){
				node.onmouseover=function()
				{
					if (this.className=='selected'){
						this.oldClassName='selected';
					}
					this.className="allum selected";
				}
				node.onmouseout=function()
				{
					if (this.oldClassName!='selected'){
						this.className='rien';
					} else {
						this.className='selected';
					}
				}
			}
		}
	}
	window.onload=startList;
</script>

<ul id="nav">
    <?php foreach($array_menus as $pid=>$pmenu) {?>
    <?php if (in_array($this->session->userdata("id_group"), $pmenu['parent']["ALLOW_ACCESS"])) {?>
    <li<?php if($section == $pmenu['parent']['SECTION']) { ?> class="selected"<?php } ?>>
        <?php if ($this->session->userdata('id_group') == EDITOR && $pmenu['parent']['SECTION'] == 'user') {?>
            <a href="<? echo APPLICATION_URL.'/user/detail/'.$this->session->userdata('user_id'); ?>"><?php echo _LB_ACOUNT; ?></a>
            <ul class="sub">
                <li><a href="<? echo APPLICATION_URL.'/user/form/'.$this->session->userdata('user_id');?>"><?php echo _LB_EDIT_ACCOUNT; ?></a></li>
                <li class="separator"><div class="line"></div></li>
                <li><a href="<? echo APPLICATION_URL.'/user/change_password/'.$this->session->userdata('user_id');?>"><?php echo _LB_CHANGE_PASSWORD; ?></a></li>
            </ul>
        <?php } else { ?>
            <a href="<? echo (($pmenu['parent']['LINK'] != '#')?APPLICATION_URL.'/'.$pmenu['parent']['LINK']."/":'#'); ?>"><?php echo $pmenu['parent']['NAME']; ?></a>
            <?php if(count($pmenu['childs'])) {?>
            <?php $index = 0;?>
            <ul class="sub">
                <?php foreach($pmenu['childs'] as $cid=>$cmenu) {?>
                <?php if (in_array($this->session->userdata("id_group"), $cmenu['child']["ALLOW_ACCESS"])) {?>
                <?php if($index>0) {?>
                <li class="separator"><div class="line"></div></li>
                <?php } ?>
                <li><a href="<? echo APPLICATION_URL.'/'.$cmenu['child']['LINK'].'/'; ?>"><?php echo $cmenu['child']['NAME']; ?></a></li>
                <?php } ?>
                <?php $index++;?>
                <?php } ?>
            </ul>
            <?php }?>
        <?php } ?>
	</li>
    <?php } ?>
	<?php } ?>
</ul>

<div class="menu-line">&nbsp;</div>
